package cn.sany.cterminal.common.enumeration;

/**
 * 1：车辆启动状态（ready）
 2：车辆上电（ACC ON）
 3：熄火（keyoff）
 4：蓄电池下电
 5：异常

 */
public enum VehicleStateEnum {
    START(1, "启动状态"),
    ACC_ON(2, "车辆上电"),
    KEY_OFF(3, "熄火"),
    LOST_POWER(4, "蓄电池下电"),
    EXCEPTION(5, "异常");
    /**
     * 状态编码
     **/
    private int code;

    /**
     * 状态信息
     **/
    private String msg;


    VehicleStateEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }
    public static String getMsgByCode(int code){
        for(VehicleStateEnum responseEnum : VehicleStateEnum.values()) {
            if(responseEnum.getCode() == code){
                return responseEnum.msg;
            }
        }
        return null;
    }
}
